package com.zgm.ch06.aop.aspectJ.advice.after._2_5_2_2;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;

import com.zgm.ch06.aop.common.User;

@Aspect
public class AftefAspect {

//	@AfterReturning("execution(* com.zgm.ch06.aop.services.*.*(..))")
	@AfterReturning(pointcut = "execution(* com.zgm.ch06.aop.services.*.*(..))",
					returning = "ret",
					argNames = "ret")
	public void auditCall(Object ret) {
		
		System.out.println("后置通知执行了,ret = " + ret);
		
		if(ret instanceof User) {
			((User) ret).setPassword("****"); 
			System.out.println("ret是User的类型的实例");
		}
	}
	
	
	
	/*@AfterReturning("execution(* com.zgm.ch06.aop.services.*.*(..))")
	public void auditCall() {
		
		System.out.println("后置通知执行了");
	}
	
	@AfterReturning("execution(* com.zgm.ch06.aop.services.*.*(..))")
	public void auditCall(JoinPoint jp) {
		
		System.out.println("后置通知执行了: " + jp);
	}*/
}
